#ifndef SWFHeader_H
#define SWFHeader_H

#include "Rect.h"
namespace swfstream {
class SWFHeader: public SwfObject {
public:
	uint8 signature; ///< 'F' or 'C'
	bool isCompressed;
	uint8 signature2; ///< 'W'
	uint8 signature3; ///< 'S'
	uint8 version; ///< Single byte file version (for example, 0x06 for SWF 6)
	uint32 file_length; ///< Length of entire file in bytes
	Rect* frame_size;
	uint16 frame_rate; ///< Frame delay in 8.8 fixed number of frames per second
	uint16 frame_count; ///< Total number of frames in file
	static SWFHeader* from_file(FILE* f);
	virtual TiXmlElement* toTiXmlElement() {
		TiXmlElement* r = new TiXmlElement("SWFHeader");
		r->SetAttribute("isCompressed", isCompressed);
		r->SetAttribute("version", version);
		r->SetAttribute("file_length", file_length);
		r->SetAttribute("frame_rate", frame_rate);
		r->SetAttribute("frame_count", frame_count);
		TiXmlElement* tmp = new TiXmlElement("frameSize");
		r->LinkEndChild(tmp);
		tmp->LinkEndChild(frame_size->toTiXmlElement());
		return r;
	}
	void print();
	/*
	 size_t size_in_file() const{
	 return 12+frame_size->size_in_file();
	 };
	 */
};
}
#endif
